<?php
declare (strict_types = 1);

namespace app\adminapi\validate;

use think\Validate;

class CheckBrand extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        "name" => "require|unique:brand",
        "desc" => "require",
        "url" => "require",
        "sort" => "require",
        "cate_id" =>"require",
        "is_hot" => "require",
        "logo" => 'require|file|fileSize:2000000|image'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name.require'=>'品牌名必须填写',
        'desc.require'=>'品牌描述必须填写',
        'url.require'=>'品牌官网地址必须填写',
        'sort.require'=>'品牌排序必须填写',
        'cate_id.require'=>'品牌类型必须填写',
        'is_hot.require'=>'是否热门必须填写',
        'logo.require'=>'logo必须填写',
        'logo.image'=>'logo必须是图片',
        'logo.fileSize'=>'logo大小不符合',
    ];
}
